



cat <<EOF > /etc/cron.d/alertmanager_config_reload
* * * * * root /bin/bash /opt/app/alertmanager/alertmanager_config_reload.sh
EOF



cat <<-"EOF" > /opt/app/alertmanager/alertmanager_config_reload.sh

#rm -rf data
MY_IP=`hostname -I |awk '{print $1}' |tr  -d " "`
#MY_IP="192.168.0.82"
# api地址
HOST="192.168.0.26"
res=`curl http://${HOST}/noAuth/downLoadAlertManagerMainConfigYaml?ip=${MY_IP}  `
echo $res
if test -z "$res"; then
  echo "downLoadalertmanagerMainConfigYaml.empty"
  exit 2
fi

echo "$res" >  /opt/app/alertmanager/alertmanager.yml ;curl -v  -X POST http://localhost:9093/-/reload

EOF



